package xcmg.device.dao.mapper.warehouse;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.warehouse.DeliveryInstructionDetailDO;
import xcmg.device.service.vo.warehouse.DeliveryInstructionDetailVO;

import java.util.List;

@Mapper
public interface DeliveryInstructionDetailMapper {
    int deleteByPrimaryKey(String id);

    int insert(DeliveryInstructionDetailDO record);

    DeliveryInstructionDetailDO selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(DeliveryInstructionDetailDO record);

    List<DeliveryInstructionDetailDO> findByDeliveryOrder(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    List<DeliveryInstructionDetailDO> findByDeliveryOrderForLocationUser(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    int deleteByDeliveryOrder(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    List<DeliveryInstructionDetailDO> list(DeliveryInstructionDetailVO vo);

    int removeByOrderList(@Param("orderList") List<String> orderList, @Param("orgId") String orgId);

    DeliveryInstructionDetailDO findByDeliveryOrderAndMaterialNo(@Param("deliveryOrder") String deliveryOrder, @Param("materialNo") String materialNo, @Param("rowNo") Integer rowNo, @Param("orgId") String orgId);

    int countNotPosted(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    int findNumByState(@Param("deliveryOrder") String deliveryOrder, @Param("state") Integer state, @Param("orgId") String orgId);

	int findNum(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    int updateStatus(@Param("status") String status, @Param("billNo") String billNo,@Param("materialsNo") String materialsNo, @Param("rowNo") Integer rowNo);

    /**
     * 获取该公司下可以过账的配送指令入库零件
     *
     * @param orgId
     * @return
     */
    List<DeliveryInstructionDetailDO> list4SapPosting(@Param("orgId")String orgId);
}